
package com.pmcc.core.entity.security;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.pmcc.core.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by lihaiyue on 2017/8/15.
 */
@Getter
@Setter
@Entity
@Table(name = "SYS_ORGANIZATION")
public class Organization extends BaseEntity {

    @Column(name = "CODE", length = 50)
    private String code;//机构编号

    @Column(name = "NAME", length = 100)
    private String name;//机构中文名称

    @Column(name = "DESCRIPTION", length = 200)
    private String description;//机构说明

    @Column(name = "PARENT_ID", length = 32)
    private String parentId;//上级机构ID

    @Column(name = "LEVEL", length = 11)
    private Integer level;//树形层级

    @Column(name = "SORT_NO", length = 11)
    private Integer sortNo;//排序编号

    @Column(name = "STATUS", length = 20)
    private String status;//状态

    @JsonIgnore
    @OneToMany(mappedBy = "organization", cascade = CascadeType.ALL,
            fetch = FetchType.LAZY, orphanRemoval = true)
    private List<Employee> employeeList = new ArrayList<>();

}
